<?php

namespace common\models\rbac;

use Yii;

/**
 * This is the model class for table "{{%rbac_module}}".
 *
 * @property int $id
 * @property string $name 模块名称
 * @property string $flag 模块标识
 * @property string $url 模块链接
 * @property string $class_style 模块对应的样式名
 * @property int $status 状态【-1删除、0禁用、1启用】
 * @property int $sort 排序
 * @property int $created_at 添加时间
 * @property int $updated_at 更新时间
 */
class Module extends \common\models\BaseModel
{
    const STATUS_DELETE = -1;// 删除
    const STATUS_INVALID = 0;// 失效
    const STATUS_ENABLE = 1;// 正常

    public static $statuss = [
        self::STATUS_DELETE => '删除',
        self::STATUS_INVALID => '停用',
        self::STATUS_ENABLE => '启用',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%rbac_module}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['status', 'sort', 'created_at', 'updated_at'], 'integer'],
            [['name', 'flag', 'url'], 'string', 'max' => 100],
            [['class_style'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => '模块名称',
            'flag' => '模块标识',
            'url' => '模块链接',
            'class_style' => '模块对应的样式名',
            'status' => '状态【-1删除、0禁用、1启用】',
            'sort' => '排序',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
        ];
    }
}
